<%--
  Created by IntelliJ IDEA.
  User: SYHT
  Date: 2017/4/10
  Time: 13:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%--<title>one</title>--%>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <jsp:include page="documentForeEnd.jsp"/>
        <%--<link href="${pageContext.request.contextPath}/dist/foreEnd/css/bootstrap.css" rel="stylesheet"/>--%>
        <link href="${pageContext.request.contextPath}/dist/foreEnd/css/onet.css" rel="stylesheet"/>
</head>
<body>
<header>
    <jsp:include page="headerForeEnd2.jsp"/>
    <script type="application/javascript">
        var tis = new tis(300);
        function go(type) {
            var importType =  document.getElementById("importType");
            importType.value = type;
            var importForm = document.getElementById("importForm");
            var Files = document.getElementById("uploadFile");
            var fileList = Files.files;
            for(var i=0;i<fileList.length;i++){
                var importName = fileList[i].name;
                if(!importName.endsWith(".doc")&&!importName.endsWith(".xls")){
                    tis.alert("文件格式不正确");
                    return;
                }else if(fileList[i].size>1024*500){
                    tis.alert("文件太大！单一文件不能超过500KB");
                    return;
                }
            }
            importForm.submit();
        }

        function selectedFlie() {
            alert("a");
        }

        //判断当前字符串是否以str结束
        if (typeof String.prototype.endsWith != 'function') {
            String.prototype.endsWith = function (str){
                return this.slice(-str.length) == str;
            };
        }
    </script>
</header>

<div class="container">
    <a href="${pageContext.request.contextPath}/Person/selPersonAll.do"><span class="ff fa fa-arrow-right fa-2x"></span></a>

    <div class="content">
        <div id="button-wrapper" class="file-box">
            <form id="importForm" action="${pageContext.request.contextPath}/Person/importPersonbatch.do" method="post" enctype="multipart/form-data">
                <div class="big">
                    <a href="javascript:void(0)" onclick="go('zl')" class="a-btn">
                        <span></span>
                        <span>智联入口</span>
                        <span>智联入口</span>
                    </a>
                    <div class="uploader black">
                            <%--<input id="importName" type="text" class="filename" readonly="readonly" style="width: 400px"/>--%>
                            <input id="importType" type="hidden" name="type">
                            <input type="button" name="file" class="button" value="点击导入"/>
                            <input id="uploadFile" type="file" size="30" name="files[]"style="margin-right: 20px" multiple=true/>
                            <%--<ul id='content'></ul>--%>


                    </div>
                    <textarea id="content" class="person_t" readonly style="width: 430px;height:
                    80px;position: absolute;border-radius: 7px;top: 180px;left: 20px;;outline: none;"></textarea>
                </div>

                <div class="big2">
                    <a href="javascript:void(0)" onclick="go('qc')" class="a-btn">
                        <span></span>
                        <span>前程入口</span>
                        <span>前程入口</span>
                    </a>
                   <%-- <div class="uploader2 black">
                            <input type="file" size="30" name="file"/>
                    </div>--%>
                </div>
             </form>

            <div class="big">
                <a href="${pageContext.request.contextPath}/Person/editPerson.do" class="a-btn">
                    <span></span>
                    <span>其他</span>
                    <span>点击录入</span>
                </a>
                <%--<div class="uploader3 black">
                    <input type="button" name="file" class="button" value="点击提交"/>
                </div>--%>
            </div>
        </div>

    </div>

</div>

<script>
    var test = document.getElementById('uploadFile');
    test.addEventListener('change', function() {
        var t_files = this.files;
        var str = '';
        for (var i = 0, len = t_files.length; i < len; i++) {
            var size = t_files[i].size / 1024;
            size = size.toFixed(1);
            str += '名称：' + t_files[i].name + '大小:' + size + 'KB'+"\r\n";
        };
        document.getElementById('content').innerHTML = str;
    }, false);
</script>


<script>$(function () {
    $("input[type=file]").change(function () {
        $(this).parents(".uploader").find(".filename").val($(this).val());
    });
    $("input[type=file]").each(function () {
        if ($(this).val() == "") {
            $(this).parents(".uploader").find(".filename").val("...");
        }
    });
    $("input[type=file]").change(function () {
        $(this).parents(".uploader2").find(".filename").val($(this).val());
    });
    $("input[type=file]").each(function () {
        if ($(this).val() == "") {
            $(this).parents(".uploader2").find(".filename").val("...");
        }
    });
});
</script>
<script type="text/javascript">
    $(document).ready(function() {
        $('#nav li').hover(function() {
            $('ul', this).slideDown(200);
            $(this).children('a:first').addClass("hov");
        }, function() {
            $('ul', this).slideUp(100);
            $(this).children('a:first').removeClass("hov");
        });
    });
</script>
</body>
</html>